/**
 * 
 */
package cvcg.service;

import java.util.List;
import java.util.Set;

import org.apache.click.control.Form;
import org.apache.click.control.Select;
import org.apache.click.extras.control.PickList;

import cvcg.dto.GameSessionVoteDTO;
import cvcg.dto.Top5DTO;
import cvcg.dto.Top5ResultDTO;
import cvcg.dto.VoteResultDTO;
import cvcg.model.Game;
import cvcg.model.GameSession;
import cvcg.model.Player;
import cvcg.model.Role;
import cvcg.model.Score;

/**
 * @author jaracje
 *
 */
public interface GameSessionService {

	/**
	 * Get all players
	 * @return list of all players
	 */
	List<Player> getAllPlayers();
	
	/**
	 * Get all games
	 * @return list of all games
	 */
	List<Game> getAllGames();
	
	/**
	 * Get all game sessions
	 * @return list of all game sessions
	 */
	List<GameSession> getAllGameSessions();
	
	/**
	 * Delete a player
	 * @param id of player to delete
	 */
	void deletePlayer(Long id);
	
	/**
	 * Get a player by id
	 * @param id of player to get
	 * @return corresponding player
	 */
	Player getPlayerById(Long id);
	
	/**
	 * Save player
	 * @param playerId player identifier
	 * @param playerForm player form
	 * @param ownedGamesPickList owned games pickList
	 * @param ruleMasteredGamesPickList rules mastered games pickList
	 * @param rolesPickList roles pickList
	 */
	void savePlayer(Long playerId,Form playerForm,PickList ownedGamesPickList,PickList ruleMasteredGamesPickList,PickList rolesPickList);
	
	/**
	 * Delete a game
	 * @param id of game to delete
	 */
	void deleteGame(Long id);
	
	/**
	 * Get a game by id
	 * @param id of game to get
	 * @return corresponding game
	 */
	Game getGameById(Long id);

	/**
	 * @param gameId game identifier
	 * @param gameForm game form
	 */
	void saveGame(Long gameId,Form gameForm);
	
	/**
	 * @param gameSessionId game session identifier
	 * @return corresponding game session or null if not found
	 */
	GameSession getGameSessionById(Long gameSessionId);
	
	List<Role> getAllRoles();	
	
	/**
	 * Delete a game session
	 * @param id of game session to delete
	 */
	void deleteGameSession(Long id);
	
	/**
	 * Save game session
	 * @param gameSessionId game session identifier
	 * @param gameSessionForm game session form
	 */
	void saveGameSession(Long gameSessionId, Form gameSessionForm, PickList playedGamesPickList);
	
	void toggleGameSessionUser(Long gameSessionId, String playerName);
	
	Player getPlayerByName(String playerName);
	
	/**
	 * Add a game session vote 
	 * @param gameSessionId game session identifier
	 * @param gameId game identifier
	 * @param playerName player name
	 */
	public void addGameSessionVote(Long gameSessionId, Long gameId,String playerName);
	
	public List<GameSessionVoteDTO> getGameSessionVotes(Long gameSessionId);
	
	public void removeGameSessionVote(Long gameSessionId, Long gameId,String playerName);
	
	public Set<Long> getVotedGameIdByGameSessionIdAndPlayerName(Long gameSessionId,String playerName) ;
	
	public GameSession getNextGameSession();
	
	public List<GameSession> getPhase1GameSessions();
	
	public List<GameSession> getPhase2GameSessions();
	
	public List<GameSession> getClosedGameSessions();
	
	public void goNextPhase(Long gameSessionId);
	
	public void saveTop5(Long gameSessionId,String playerName,List<Top5DTO> top5List);
	
	public List<VoteResultDTO> getVoteResultForGameSession(Long gameSessionId);
	
	public List<Top5ResultDTO> getTop5ResultForGameSession(Long gameSessionId);
	
	public List<Score> getScoreByPlayerName(String playerName);
	
	public Score getScoreById(Long id);
	
	public List<Score> getAllScores();
	
	public void saveScore(Long scoreId, Form scoreForm,Select playerSelect, Select gameSelect);
	
	public void deleteScore(Long id);
	
	public List<Game> getAllGamesWithoutScore();
}
